package com.sporadic.backstage.controller;

import com.sporadic.backstage.entity.OrderDetails;
import com.sporadic.backstage.service.OrderDetailsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;


@CrossOrigin(origins = {"http://localhost:8080"}, methods = {RequestMethod.GET, RequestMethod.POST}, allowCredentials = "true")
@Controller
public class OrderDetailsController {

    @Autowired
    private OrderDetailsService orderdetailsService;

    /**
     * 查询店铺进七天销售前三名的菜品
     * @param merchantId 店铺编号
     * @return 菜品名集合
     */
    @RequestMapping("/selTop3Details")
    @ResponseBody
    public List<OrderDetails> selTop3Details(Integer merchantId){
        return orderdetailsService.selTop3Details(merchantId);
    }


}
